package CollectionDemo;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Created with IntelliJ IDEA.
 * Description:增强for遍历
 * User: 阿宾
 * Date: 2024-10-31
 * Time: 15:54
 */
public class Demo4 {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<>();
        //添加元素
        collection.add("aaa");
        collection.add("bbb");
        collection.add("ccc");
        //遍历
        //快速生成增强for遍历：集合名称.for 回车
        /*for (String s : collection) {
            System.out.print(s + " ");
        }*/
        for (String s : collection) {
            s = "qqq";
        }
        System.out.println(collection);
    }
}
